﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pgJOficios.aspx.cs" Inherits="EGuayas.Web.EGlobal.jefaud.pgOficios" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link  href="~/Resources/css/Style.css"  rel="stylesheet" />
    <!-- Load Ext JS --> 
    <script src="../../Resources/js/Global.js"></script>
</head>
<body><ext:ResourceManager ID="ResourceManager1" runat="server" />
    <form id="form1" runat="server">
    <div>
        
        <ext:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
            <Items>  
              <ext:FormPanel  runat="server" Region="Center" Layout="VBoxLayout">
                <LayoutConfig>
                    <ext:VBoxLayoutConfig Align="Stretch" />
                </LayoutConfig> 
                   <Items>
                        <ext:Hidden Text="" ID="hdGlobalJefatura" Name="GlobalJefatura" runat="server"></ext:Hidden>        
                         <ext:Window
                        ID="winAprobar"
                        runat="server"
                        Height="550"
                        Width="650"
                        ButtonAlign="Center"
                        BodyStyle="background-color: #fff;"
                        BodyPadding="5"
                        Hidden="true"
                        CloseAction="Hide"
                        Plain="true"                 
                        HeaderPosition="Bottom"
           
                        Layout="BorderLayout">
                        <Items>
                            <ext:Panel ID="plDocumentoApro" runat="server"
                                Region="Center"
                                Icon="Zoom"
                                BodyPadding="6"
                                Header="true"
                                ButtonAlign="Left"
                                Layout="AnchorLayout">
                                <Items>
                                     <ext:Hidden Text="" ID="hdRuta" Name="Ruta" runat="server"></ext:Hidden>  
                                </Items>
                   
                            </ext:Panel>
                <ext:FormPanel
                    ID="forPanelApro"
                    Region="East"
                    Split="true"
                    runat="server"
                    Width="330"
                    Title="Revizar"
                    BodyPadding="5"
                    Icon="NoteEdit"
                    Collapsible="true"
                    Layout="FitLayout">
                    <FieldDefaults LabelWidth="75" LabelPad="20" LabelSeparator="" />
                    <Items>
                        <ext:Panel ID="Panel1" runat="server" Border="false" Layout="Form" ColumnWidth=".5" LabelAlign="Top">
                            <Defaults>                             
                                <ext:Parameter Name="MsgTarget" Value="side" />
                            </Defaults>
                            <Items>       
                                            <ext:Hidden Text="" ID="hddIdOf" Name="Id" runat="server"></ext:Hidden>
                                            <ext:Hidden Text="" ID="hddnDocUpId1" Name="ArchivoId" runat="server"></ext:Hidden>
                                            <ext:TextField ID="txtNumero1" Name="Numero" runat="server" FieldLabel="Número" AllowBlank="false" />
                                            <ext:TextField ID="txtNombre1" Name="Nombre" runat="server" FieldLabel="Nombre" AllowBlank="false" />
                                            <ext:Hidden Text="" ID="hddnDocUpVers1" Name="Version" runat="server"></ext:Hidden>
                                            <ext:Hidden Text="" ID="hddnDocUpRef1" Name="Referencia" runat="server"></ext:Hidden>
                                            <ext:TextArea ID="txtDesp1" runat="server" FieldLabel="Detalle" Name="Descripcion" AllowBlank="false"/>
                                            <ext:TextArea runat="server" ID="txtCometarioRevizar1"   AllowBlank="true" FieldLabel="Comentario" Name="Comentario" Height="170" AutoScroll="true" ReadOnly="true"></ext:TextArea>
                                            <ext:FileUploadField
                                                ID="FileUploadDocUp1"                      
                                                runat="server"
                                                EmptyText="Seleccione documento"
                                                FieldLabel="Documento"
                                                ButtonText=""
                                                Icon="ImageAdd" AllowBlank="false">                                                                                             
                                             </ext:FileUploadField>
                                            <ext:TextField ID="txtEmail1" 
                                                runat="server"
                                                FieldLabel="Email"
                                                Name="Correo"
                                                Vtype="email"
                                                Flex="1"
                                                AllowBlank="false">
                                            </ext:TextField>
                                             
                                            
                            </Items>                     
                         </ext:Panel>
                    </Items>
                    <Listeners>
                        <ValidityChange Handler="#{btnAprobar1}.setDisabled(!valid);" />
                    </Listeners>
                </ext:FormPanel>

            </Items>
            <Buttons>
                <ext:Button ID="btnAprobar1" runat="server" Text="Aceptar" 
                    FormBind="true">
                    <DirectEvents>                       
                        <Click OnEvent="btnAceptar_Click"
                                           Before="return pgFnOficio.checkExtensionDoc('FileUploadDocUp1');"
                                           Failure="Ext.Msg.show({ 
                                                    title   : 'Error', 
                                                    msg     : 'Error', 
                                                    minWidth: 200, 
                                                    modal   : true, 
                                                    icon    : Ext.Msg.ERROR, 
                                                    buttons : Ext.Msg.OK 
                                                });">
                            <ExtraParams>
                                 <ext:Parameter Name="Id" Value="#{hddIdOf}.getValue()" Mode="Raw" />
                                 <ext:Parameter Name="IdUPField" Value="FileUploadDocUp1" Mode="Value" />
                                 <ext:Parameter Name="txtNombre" Value="#{txtNombre1}.getValue()" Mode="Raw" />
                                 <ext:Parameter Name="txtDesp" Value="#{txtDesp1}.getValue()" Mode="Raw" />
                                 <ext:Parameter Name="Correo" Value="#{txtEmail1}.getValue()" Mode="Raw" />
                                 <ext:Parameter Name="txtNumero" Value="#{txtNumero1}.getValue()" Mode="Raw" />
                                 <ext:Parameter Name="hddnDocUpVers" Value="#{hddnDocUpVers1}.getValue()" Mode="Raw" />
                                 <ext:Parameter Name="hddnDocUpId" Value="#{hddnDocUpId1}.getValue()" Mode="Raw" />
                                 <ext:Parameter Name="hddnDocUpRef" Value="#{hddnDocUpRef1}.getValue()" Mode="Raw" />
                            </ExtraParams>
                            <EventMask ShowMask="true"></EventMask>
                          
                        </Click>                        
                    </DirectEvents>
                </ext:Button>
              
                <ext:Button ID="Button3" runat="server" Text="Cancelar" OnClientClick="AppGlobalJs.closeWin(#{winAprobar})">
                    <Listeners>
                    </Listeners>
                </ext:Button>
            </Buttons>
            <Listeners>
                <BeforeHide Handler="#{forPanelApro}.getForm().reset();"></BeforeHide>
            </Listeners>
        </ext:Window>

                   <%--:: Venana popup --%>
                   <ext:Window
                        ID="winProceso"
                        runat="server"
                        Height="350"
                        Width="350"
                        ButtonAlign ="Center"
                        BodyStyle ="background-color: #fff;"
                        BodyPadding="5"
                        Hidden ="true"
                        Icon="EmailGo"
                        CloseAction="Hide"
                        Plain  ="true"                 
                        Title  ="Nuevo oficio"
                        Layout ="BorderLayout">
                        <Items> 
                             <ext:FormPanel
                                ID="forPanelProc"
                                Region="Center"
                                Split="true"
                                runat="server" 
                                Border="false"                             
                                BodyPadding="5"                              
                                Layout="FitLayout">
                                <FieldDefaults LabelWidth="75" LabelPad="20" LabelSeparator="" />
                                <Items>
                                    <ext:Panel ID="Panel3" runat="server" Border="false" Layout="Form" ColumnWidth=".5" LabelAlign="Top">
                                        <Defaults>                     
                                        </Defaults>
                                        <Items>       
                                          
                                            <ext:Hidden Text="" ID="hddnDocUpId" Name="ArchivoId" runat="server"></ext:Hidden>
                                            <ext:TextField ID="txtNumero" Name="Numero" runat="server" FieldLabel="Número" AllowBlank="false" />
                                            <ext:TextField ID="txtNombre" Name="Nombre" runat="server" FieldLabel="Nombre" AllowBlank="false" />
                                            <ext:Hidden Text="" ID="hddnDocUpVers" Name="Version" runat="server"></ext:Hidden>
                                            <ext:Hidden Text="" ID="hddnDocUpRef" Name="Referencia" runat="server"></ext:Hidden>
                                            <ext:FileUploadField
                                                ID="FileUploadDocUp"                      
                                                runat="server"
                                                EmptyText="Seleccione documento"
                                                FieldLabel="Documento"
                                                ButtonText=""
                                                Icon="ImageAdd" AllowBlank="false">
                                                                                             
                                              </ext:FileUploadField>
                                             <ext:TextArea ID="txtDesp" runat="server" FieldLabel="Detalle" Name="Descripcion" AllowBlank="false"/>
                                              <ext:TextField ID="txtEmail" 
                                                runat="server"
                                                FieldLabel="Email"
                                                Name="Correo"
                                                Vtype="email"
                                                Flex="1"
                                                AllowBlank="false">
                                            </ext:TextField>
                                        </Items>                     
                                     </ext:Panel>
                                </Items>
                                <Listeners>
                                    <ValidityChange Handler="#{btnAprobar}.setDisabled(!valid);" />
                                </Listeners>
                            </ext:FormPanel>
                        </Items>
                        <Buttons>
                            <ext:Button ID="btnAprobar" runat="server" Text="Aceptar" Disabled="true"  
                                FormBind="true">
                                <DirectEvents>                       
                                    <Click OnEvent="btnAceptar_Click"
                                           Before="return pgFnOficio.checkExtensionDoc('FileUploadDocUp');"
                                           Failure="Ext.Msg.show({ 
                                                    title   : 'Error', 
                                                    msg     : 'Error', 
                                                    minWidth: 200, 
                                                    modal   : true, 
                                                    icon    : Ext.Msg.ERROR, 
                                                    buttons : Ext.Msg.OK 
                                                });">
                                        <ExtraParams>
                                            <ext:Parameter Name="Id" Value="" Mode="Value" />
                                            <ext:Parameter Name="IdUPField" Value="FileUploadDocUp" Mode="Value" />
                                            <ext:Parameter Name="txtNombre" Value="#{txtNombre}.getValue()" Mode="Raw" />
                                            <ext:Parameter Name="txtDesp" Value="#{txtDesp}.getValue()" Mode="Raw" />
                                            <ext:Parameter Name="txtNumero" Value="#{txtNumero}.getValue()" Mode="Raw" />
                                            <ext:Parameter Name="Correo" Value="#{txtEmail}.getValue()" Mode="Raw" />
                                            <ext:Parameter Name="hddnDocUpVers" Value="#{hddnDocUpVers}.getValue()" Mode="Raw" />
                                            <ext:Parameter Name="hddnDocUpId" Value="#{hddnDocUpId}.getValue()" Mode="Raw" />
                                            <ext:Parameter Name="hddnDocUpRef" Value="#{hddnDocUpRef}.getValue()" Mode="Raw" />                            
                                        </ExtraParams>
                                        <EventMask ShowMask="true"></EventMask>                         
                                    </Click>                        
                                </DirectEvents>
                            </ext:Button>
                            <ext:Button ID="btnCancelar" runat="server" Text="Cancelar" OnClientClick="AppGlobalJs.closeWin(#{winProceso})">
                                <Listeners>
                                </Listeners>
                            </ext:Button>
                        </Buttons>
                        <Listeners>
                            <BeforeHide Handler="#{forPanelProc}.getForm().reset();"></BeforeHide>
                        </Listeners>
                    </ext:Window>
                   <ext:TabPanel ID="TabPanel1" runat="server"  Flex="1">
                         <Items>
                               <ext:FormPanel ID="FormPanel1" runat="server" Region="Center" Layout="Fit" Title  ="Documentos Enviados" 
                                    Icon="EmailGo" > 
                                       <TopBar>
                                        <ext:Toolbar ID="Toolbar1" runat="server">
                                        <Items>
                                            <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                                            <ext:Button 
                                                ID="btnForm"
                                                runat="server" 
                                                Text="Nuevo Oficio" 
                                                Icon="EmailAdd"
                                                OnClientClick="pgFnOficio.ShowProc();">                                                                     
                                                <Listeners>                     
                                                </Listeners>
                                            </ext:Button>
                                        </Items>
                                    </ext:Toolbar>
                                      </TopBar>                          
                                      <Items>  
                             
                                                <ext:GridPanel
                                                    ID="gpDocumentosLoad"
                                                    runat="server"                                           
                                                    Height="90">
                                                    <Store>
                                                        <ext:Store ID="Store2" runat="server">
                                                            <Model>
                                                                <ext:Model ID="Model2" runat="server" IDProperty="Id">
                                                                    <Fields>
                                                                        <ext:ModelField Name="Id" Type="String" /> 
                                                                        <ext:ModelField Name="Fecha" Type="Date" />
                                                                        <ext:ModelField Name="Numero" Type="String" />
                                                                        <ext:ModelField Name="Descripcion" Type="String" />
                                                                        <ext:ModelField Name="Estado" Type="String" />
                                                                        <ext:ModelField Name="Comentario" Type="String" /> 
                                                                        <ext:ModelField Name="Nombre" Type="String" />   
                                                                        <ext:ModelField Name="Ruta" Type="String" />                                                                                                                                
                                                                    </Fields>
                                                                </ext:Model>
                                                            </Model>                                      
                                                            <Proxy>
                                                                <ext:PageProxy DirectFn="App.direct.BindDataProcesos">                                                              
                                                                    <Reader>
                                                                        <ext:JsonReader></ext:JsonReader>
                                                                    </Reader>
                                                                </ext:PageProxy>
                                                            </Proxy>
                                                        </ext:Store>
                                                    </Store>
                                                    <ColumnModel ID="ColumnModel2" runat="server">
                                                        <Columns>
                                                            <ext:Column ID="Column1"  runat="server" Text="Id" DataIndex="Id" Flex="1" Hidden="true"/>
                                                            <ext:DateColumn ID="DateColumn3" runat="server" Text="Fecha" Width="95" DataIndex="Fecha" Format="dd-m-yy" />                                                        
                                                            <ext:Column ID="Column2"  runat="server" Text="Número" DataIndex="Numero"/>
                                                            <ext:Column ID="Column3"  runat="server" Text="Descripción" DataIndex="Descripcion" Flex="1"/> 
                                                            <ext:Column ID="Column6"  runat="server" Text="Estado" DataIndex="Estado" >
                                                                        <Renderer Fn="pgFnOficio.ChangeLabel" />
                                                                </ext:Column>
                                                              
                                                                                                                  
                                                                                                                                         
                                                        </Columns>                                                    
                                                    </ColumnModel>                                                                                                               
                                                     <Features>
                                                                <ext:GridFilters runat="server" ID="GridFilters1" Local="true" MenuFilterText="Filtrar por">
                                                                    <Filters>
                                                                        <ext:StringFilter DataIndex="Numero"  EmptyText="Número"/>                                                                        
                                                                        <ext:DateFilter   DataIndex="Fecha" AfterText="Despues de" BeforeText="Antes de"  OnText="En" >
                                                                            <DatePickerOptions runat="server" TodayText="Ahora" />
                                                                        </ext:DateFilter>                                                            
                                                                   
                                                                    </Filters>
                                                                </ext:GridFilters>
                                                        </Features> 
                                                </ext:GridPanel>                                                  
                          
                                    </Items>
                       
                           <BottomBar>
                             <ext:StatusBar 
                                    ID="StatusBar2" 
                                    runat="server"
                                    StatusAlign="Left">
                                    <Items>                                
                                        <ext:ToolbarTextItem ID="ToolbarTextItem1" runat="server" Text="" Cls="ux-bold-text-item"  Margin="15"/>
                                    </Items>
                                </ext:StatusBar>
                            </BottomBar>
                    </ext:FormPanel>
                               <ext:FormPanel ID="FormPanel2" runat="server" Region="Center" Layout="Fit"  Title  ="Documentos no aprobados" 
                                Icon="EmailError">                       
                                <Items>                                    
                             
                                            <ext:GridPanel
                                                ID="gpEnviados"
                                                runat="server"                                           
                                                Height="90">
                                                 <Store>
                                                        <ext:Store ID="Store1" runat="server">
                                                            <Model>
                                                                <ext:Model ID="Model1" runat="server" IDProperty="Id">
                                                                    <Fields>
                                                                        <ext:ModelField Name="Id" Type="String" /> 
                                                                        <ext:ModelField Name="Fecha" Type="Date" />
                                                                        <ext:ModelField Name="Numero" Type="String" />
                                                                        <ext:ModelField Name="Descripcion" Type="String" />
                                                                        <ext:ModelField Name="Estado" Type="String" />
                                                                        <ext:ModelField Name="Comentario" Type="String" /> 
                                                                        <ext:ModelField Name="Referencia" Type="String" />
                                                                         <ext:ModelField Name="Nombre" Type="String" />
                                                                        <ext:ModelField Name="ArchivoId" Type="String" /> 
                                                                        <ext:ModelField Name="Version" Type="Int" />    
                                                                        <ext:ModelField Name="Ruta" Type="String" />   
                                                                        <ext:ModelField Name="Correo" Type="String" />                                                
                                                                    </Fields>
                                                                </ext:Model>
                                                            </Model>                                      
                                                            <Proxy>
                                                                 <ext:PageProxy DirectFn="App.direct.BindDataEnviados">
                                                                    <Reader>
                                                                        <ext:JsonReader></ext:JsonReader>
                                                                    </Reader>
                                                                </ext:PageProxy>
                                                            </Proxy>
                                                        </ext:Store>
                                                    </Store>
                                                    <ColumnModel ID="ColumnModel1" runat="server">
                                                        <Columns>
                                                            <ext:Column ID="Column4"  runat="server" Text="Id" DataIndex="Id" Flex="1" Hidden="true"/>
                                                            <ext:DateColumn ID="DateColumn1" runat="server" Text="Fecha" Width="95" DataIndex="Fecha" Format="dd-m-yy" />                                                        
                                                            <ext:Column ID="Column5"  runat="server" Text="Número" DataIndex="Numero"/>
                                                            <ext:Column ID="Column9"  runat="server" Text="Estado" DataIndex="Estado" >
                                                                        <Renderer Fn="pgFnOficio.ChangeLabel" />
                                                            </ext:Column>                                                           
                                                            <ext:Column ID="Column15"  runat="server" Text="Comentario" DataIndex="Comentario"  Flex="1"/> 
                                                            <ext:Column ID="Column16" runat="server" Weight="150">
                                                                <Commands>
                                                                    <ext:ImageCommand CommandName="NewOficio" Icon="EmailEdit" Text="Nueva versión"  >                                                                
                                                                    </ext:ImageCommand>
                                                                </Commands>                                                               
                                                                <Listeners>
                                                                    <Command Handler="pgFnOficio.ShowWinNewVer(record);"></Command>
                                                                </Listeners>
                                                            </ext:Column>                                                        
                                                        </Columns>                                                    
                                                    </ColumnModel>  
                                                     <Plugins>
                                                    <ext:RowExpander ID="RowExpander2" runat="server">
                                                        <Loader ID="Loader2" runat="server" DirectMethod="#{DirectMethods}.GetSubDoc" Mode="Component">
                                                            <LoadMask ShowMask="true" />
                                                            <Params>
                                                                <ext:Parameter Name="id" Value="this.record.data.Referencia" Mode="Raw" />
                                                            </Params>
                                                        </Loader>
                                                    </ext:RowExpander>
                                                </Plugins>       
                                            </ext:GridPanel>
                                          
                          
                                </Items>
                       
                       <BottomBar>
                         <ext:StatusBar 
                                ID="StatusBar1" 
                                runat="server"
                                StatusAlign="Left">
                                <Items>                                
                                    <ext:ToolbarTextItem ID="ToolbarTextItem2" runat="server" Text="" Cls="ux-bold-text-item"  Margin="15"/>
                                </Items>
                            </ext:StatusBar>
                        </BottomBar>
           </ext:FormPanel>
                               <ext:FormPanel ID   ="FormPanel3" runat="server" Region="Center" Layout="Fit"     Title  ="Documentos Aprobados" 
                                  Icon ="EmailStart">
                                    <Items>  
                                             <ext:GridPanel
                                                    ID="gpDevueltos"
                                                    runat="server"                                           
                                                    Height="90">
                                                       <Store>
                                                        <ext:Store ID="Store3" runat="server">
                                                            <Model>
                                                                <ext:Model ID="Model3" runat="server" IDProperty="Id">
                                                                    <Fields>
                                                                        <ext:ModelField Name="Id" Type="String" /> 
                                                                        <ext:ModelField Name="Fecha" Type="Date" />
                                                                        <ext:ModelField Name="Numero" Type="String" />
                                                                        <ext:ModelField Name="Descripcion" Type="String" />
                                                                        <ext:ModelField Name="Estado" Type="String" />
                                                                        <ext:ModelField Name="Comentario" Type="String" /> 
                                                                        <ext:ModelField Name="Referencia" Type="String" />   
                                                                        <ext:ModelField Name="ArchivoId" Type="String" /> 
                                                                        <ext:ModelField Name="Version" Type="Int" />  
                                                                        <ext:ModelField Name="Nombre" Type="String" />  
                                                                        <ext:ModelField Name="Ruta" Type="String" />                                                     
                                                                    </Fields>
                                                                </ext:Model>
                                                            </Model>                                      
                                                            <Proxy>
                                                                <ext:PageProxy DirectFn="App.direct.BindDataDevueltos">
                                                                    <Reader>
                                                                        <ext:JsonReader></ext:JsonReader>
                                                                    </Reader>
                                                                </ext:PageProxy>
                                                            </Proxy>
                                                        </ext:Store>
                                                    </Store>
                                                    <ColumnModel ID="ColumnModel3" runat="server">
                                                        <Columns>
                                                            <ext:Column ID="Column8"  runat="server" Text="Id" DataIndex="Id" Flex="1" Hidden="true"/>
                                                            <ext:DateColumn ID="DateColumn2" runat="server" Text="Fecha" Width="95" DataIndex="Fecha" Format="dd-m-yy" />                                                        
                                                            <ext:Column ID="Column10"  runat="server" Text="Número" DataIndex="Numero"/>
                                                            <ext:Column ID="Column11"  runat="server" Text="Descripción" DataIndex="Descripcion" /> 
                                                           <ext:Column ID="Column7"  runat="server" Text="Estado" DataIndex="Estado" >
                                                                        <Renderer Fn="pgFnOficio.ChangeLabel" />
                                                                </ext:Column>
                                                             
                                                            <ext:Column ID="Column17"  runat="server" Text="Comentario" DataIndex="Comentario"  Flex="1"/> 
                                                                                                                                                                               
                                                        </Columns>                                                    
                                                    </ColumnModel>  
                                                  <Plugins>
                                                    <ext:RowExpander ID="RowExpander1" runat="server">
                                                        <Loader ID="Loader1" runat="server" DirectMethod="#{DirectMethods}.GetSubDoc" Mode="Component">
                                                            <LoadMask ShowMask="true" />
                                                            <Params>
                                                                <ext:Parameter Name="id" Value="this.record.data.Referencia" Mode="Raw" />
                                                            </Params>
                                                        </Loader>
                                                    </ext:RowExpander>
                                                </Plugins>         
                                                </ext:GridPanel>
                                                  
                          
                            </Items>
                       
                           <BottomBar>
                             <ext:StatusBar 
                                    ID="StatusBar3" 
                                    runat="server"
                                    StatusAlign="Left">
                                    <Items>                                
                                        <ext:ToolbarTextItem ID="ToolbarTextItem3" runat="server" Text="" Cls="ux-bold-text-item"  Margin="15"/>
                                    </Items>
                                </ext:StatusBar>
                            </BottomBar>
               </ext:FormPanel>
              </Items>
            </ext:TabPanel>
            </Items> 
         </ext:FormPanel>
        </Items>
       </ext:Viewport>
     </div>
    </form>
     <ext:XScript ID="XScript1" runat="server">
        <script type="text/javascript">
            var pgFnOficio = new Object();    
            pgFnOficio.ChangeLabel= function (value) {
                try 
                { 
                    var template  = '<span style="color:{0};">{1}</span>';
                    var valReturn = '';
                    var valColor  = 0;
                    switch(value)
                    {
                        case "R": valReturn = 'Enviado a Revisión'; valColor  =1; break;
                        case "S": valReturn = 'Revizado'; break;
                        case "N": valReturn = 'Aprobado'; valColor  =1;break;
                     
                    }
                    return Ext.String.format(template, (valColor > 0) ? "green" : "red", valReturn);
                }
                catch (jsbug){
                    AppGlobalJs.showBug("pgFnOficioD.ChangeLabel: " + jsbug);
                }
            };
            pgFnOficio.ShowProc = function (record) 
            {
                try
                {          
                     #{winProceso}.show();                 

                } catch (jsbug) {
                    AppGlobalJs.showBug("pgFnOficio.ShowProc: " + jsbug)
                }
            };   
            pgFnOficio.ShowWinNewVer = function (record) {
                try
                {
                    //Nueva Version
                    var myPanel = null;
                    var myPanelContent = #{plDocumentoApro};
                    if (myPanelContent != null) {
                        myPanelContent.remove('pnlviewddoc_1', false);
                        myPanel = myPanelContent.add(new Ext.Panel({
                            id: 'pnlviewddoc_1',
                            border: false,
                            anchor: '100% 100%',
                   
                            loader:
                             {
                                 loadMask:
                                     {
                                         showMask: false
                                     },
                                 renderer: "frame",
                                 url:"../../pgDetailPdf.aspx?idx= "+ record.data.Ruta
                             },
                            bodyPadding: 6,
                            closable: false,

                        }));
                    }
                    #{hdRuta}.setValue(record.get('Ruta'));
                    var sumVer   = parseInt(record.data.Version)+1;
                    var nameFile =record.data.Nombre;
                    var aPosition = nameFile.indexOf(' V');
                    if (aPosition!=-1)
                    {
                        nameFile =nameFile.substring(0,aPosition);
                    }
                    #{forPanelApro}.getForm().loadRecord(record);
                    #{txtNombre1}.setValue(nameFile+' V'+sumVer);
                    #{txtNombre1}.setDisabled(true);
                    
                    #{txtNumero1}.setDisabled(true);
                    #{txtDesp1}.setDisabled(true);  
                  
                    AppGlobalJs.showWin(#{winAprobar}); 
                } catch (jsbug) {
                    AppGlobalJs.showBug("pgFnOficio.ShowWinNewVer : " + jsbug)
                }
            };
            //Chequea version .doc
            pgFnOficio.checkExtensionDoc=function(idFileup) 
            {
                try
                { 
                var flag     = true;
                var value    = "";
                if (idFileup =='FileUploadDocUp')
                    value    = #{FileUploadDocUp}.getValue().toLowerCase();
                else
                    value    = #{FileUploadDocUp1}.getValue().toLowerCase();
                if (value!="")
                    flag  = (value.match( '\.doc$')!=null|| value.match("\.docx$")!=null);                
                if (flag==false) {
                    Ext.Msg.show({
                        title: 'Error',
                        msg:  AppLabelGlobalJs.pg_format_doc,
                        buttons: Ext.Msg.ERROR,                   
                        animEl: 'elId'
                    });
                }
                var done =false;
                if (idFileup =='FileUploadDocUp')   
                    done = #{forPanelProc}.getForm().isValid();
                else
                    done = #{forPanelApro}.getForm().isValid();
                if (done && flag)
                {
                    if (value!="")
                        Ext.Msg.wait('Uploading archivo...', 'Uploading');
                }
                return (done && flag);
                } catch (jsbug) {
                    AppGlobalJs.showBug("pgFnOficio.ShowWinNewVer : " + jsbug)
                }
            };
       </script>
    </ext:XScript>  
</body>
</html>
